#pragma once
//============================================================================
// Copyright (C) 2013 Brett R. Jones
//
// Issued to public domain 2013
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================

#include "VxConnectInfo.h"
#include "FriendMatch.h"

#define MAX_ONLINE_NAME_LEN		16	//maximum length of online name including 0 terminator

#define IS_APP_PAID_FLAG			0x01	
#define OS_ANDROID_FLAG				0x02	
#define OS_LINUX_FLAG				0x04	
#define OS_WINDOWS_FLAG				0x08	

#pragma pack(push) 
#pragma pack(1)

//! implements minimum to uniquely identify user as individual on the network
//! derived from 32 + 24 + 1 + 1 = 58 bytes
//! size 58 + 2 + 4 + 4  = 68 bytes
class VxNetIdentBase : public VxConnectInfo, public FriendMatch
{
public:
	//=== vars ===//
	U8					m_u8OsAndPaidFlags;								
	U8					m_u8OfferCnt;							// offer count ( used as part of rating )
	U8					m_u8ReplyCnt;							// reply count ( used as part of rating )
	char				m_as8OnlineName[ MAX_ONLINE_NAME_LEN ];	// users online name

	VxNetIdentBase();

	void	setIsPaidUser( bool isPaid );
	bool	isPaidUser( void );

	char *	getOnlineName( void );
	void	getOnlineName( std::string& strRetName );
	void 	setOnlineName( const char * pUserName );

	bool	isFriendNearby( void );

	bool	isVxNetIdentMatch( const VxNetIdentBase& oOtherIdent ) const;

	void	useAsRelay( VxNetIdentBase * poRelayIdent );

	void	getProfileUri( std::string& retUri );


	//! equals operator
	bool operator ==( const VxNetIdentBase &a ) const;

	//! not equal operator
	bool operator != ( const VxNetIdentBase &a ) const;

	//! assignment operator
	VxNetIdentBase& operator =( const VxNetIdentBase &a );
};

#pragma pack(pop)
